package cn.cs.service;

import cn.cs.mapper.AdBannerMapper;
import cn.cs.mapper.AgentSettlementMapper;
import cn.cs.pojo.AdBanner;
import cn.cs.pojo.AgentSettlement;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@RestController
public class AgentSettlementService {

    @Resource
    private AgentSettlementMapper agentSettlementMapper;

    @RequestMapping(value = "/getAgentSettlementById", method = RequestMethod.POST)
    public AgentSettlement getAgentSettlementById(@RequestParam("id") String id) throws Exception{
        return agentSettlementMapper.getAgentSettlementById(id);
    }

    @RequestMapping(value = "/getShopSettlementDetailedById", method = RequestMethod.POST)
    public Map<String, String> getShopSettlementDetailedById(@RequestParam("id") String id) throws Exception{
        return agentSettlementMapper.getShopSettlementDetailedById(id);
    }

    @RequestMapping(value = "/getAgentSettlementListByMap", method = RequestMethod.POST)
    public List<AgentSettlement> getAgentSettlementListByMap(@RequestBody Map<String, Object> param) throws Exception{
        return agentSettlementMapper.getAgentSettlementListByMap(param);
    }

    @RequestMapping(value = "/getAgentSettlementCountByMap", method = RequestMethod.POST)
    public Integer getAgentSettlementCountByMap(@RequestBody Map<String, Object> param) throws Exception{
        return agentSettlementMapper.getAgentSettlementCountByMap(param);
    }

    @RequestMapping(value = "/addAgentSettlement", method = RequestMethod.POST)
    public Integer addAgentSettlement(@RequestBody AgentSettlement agentSettlement) throws Exception{
        return agentSettlementMapper.insertAgentSettlement(agentSettlement);
    }

    @RequestMapping(value = "/modifyAgentSettlement", method = RequestMethod.POST)
    public Integer modifyAgentSettlement(@RequestBody AgentSettlement agentSettlement) throws Exception{
        return agentSettlementMapper.updateAgentSettlement(agentSettlement);
    }

    @RequestMapping(value = "/deleteAgentSettlementById", method = RequestMethod.POST)
    public Integer deleteAgentSettlementById(@RequestParam("id") String id) throws Exception{
        return agentSettlementMapper.deleteAgentSettlementById(id);
    }

    @RequestMapping(value = "/updateShopSettlementDetailedState", method = RequestMethod.POST)
    public Integer updateShopSettlementDetailedState(@RequestParam("id")String id, @RequestParam("personId")String personId)throws Exception{
        return agentSettlementMapper.updateShopSettlementDetailedState(id, personId);
    }


}
